package com.share.homestay.hystrix;

import com.share.homestay.entity.HostelSystem;
import com.share.homestay.pojo.JsonResult;
import com.share.homestay.service.HostelSystemServiceFeign;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class HostelSystemServiceHystrix implements FallbackFactory<HostelSystemServiceFeign> {
    @Override
    public HostelSystemServiceFeign create(Throwable cause) {
        return new HostelSystemServiceFeign() {

            @Override
            public JsonResult findPageHostelSystem(HostelSystem hostelSystem, Long pageNum, Long pageSize) {
                throw new RuntimeException("运行分页查询民宿时出现异常");
            }

            @Override
            public Long delByIdHostelSystem(String id) {
                throw new RuntimeException("调用通过Id删除名宿时候出现异常");
            }
        };
    }
}
